<!-- 我的报名 -->
<template>
	<view class="pd ">
		<view class="kmxzczxrec pd pt20  pm5 box mt20" v-for="sd in jnmxcz">
			<view class="display-flex">
				<view class="flex-1">
					<view class="fz32">
						{{sd.jobName}}
					</view>
					<view class="mt20">
						<text class="tag-label mr20" v-for="(item,index) in sd.tag">{{item}}</text>
					</view>
				</view>
				<view class="ml10">
					<view class="ye fz32 b">
						{{sd.payOverall}}元月
					</view>
				</view>
			</view>
			<view class="mt30  z9 fz24">
				<view class="">
					<text class="iconfont icon-gongsiguanli z9 cz fz28"></text>
					<text class="cz ml5">{{sd.companyName}}</text>
				</view>
				<view class=" mt10">
					<text class="iconfont icon-map fz26 cz"></text>
					<text class="cz ml5">{{sd.jobAddress}}</text>
				</view>
			</view>

			<view class="btm mt20 pt10 display-flex pm10">
				<view class="flex-1 z9 fz24 vertical-center tl">
					报名时间：{{sd.createTime}}
				</view>
				<view class="">
					<button type="primary" size="mini" 
					@tap="quxsd(sd)" v-if="sd.status!=2&&sd.status!=3">取消报名</button>
					<text v-else-if="sd.status==2&&sd.isJob" class="ls fz26" >入职成功</text>
					<text class="z9 fz24" v-else-if="sd.status!=3">审核中</text>
				</view>
			</view>
			<view class="pm10" v-if="sd.status==3">
				<text class="red fz24" >审核失败:{{sd.statusContent}}</text>
			</view>
		</view>
		
		<view class="vertical-center mt100" v-if="jnmxcz.length<=0">
		
				<image src="../../static/img/noData.png" class="xczxcertfdgtrr"></image>
				<view class="mt20 z9 fz24">
					暂无数据!
				</view>
		
		</view>
		<!--    case "0": jmxcr='未审核'; break;
    case "1": jmxcr='待审核'; break;
    case "2": jmxcr='审核通过'; break;
    case "3": jmxcr='审核不通过'; break; -->
	</view>
</template>
<script lang="ts" setup>
	import { ref } from "vue"
	import { hf, hfer, hfsan, dxrequest, VerifyTheLogin } from "@/util/index.js"
	import { onShow, onLoad } from "@dcloudio/uni-app"
	const ixsd = ref(true)
	const jnmxcz = ref([])
	const quxsd = (sd) => {
		uni.showModal({
			title: "温馨提示",
			content: "确认取消报名吗?",
			async success({ confirm }) {
				if (confirm) {
					await dxrequest("/api/jobregist", [sd.id], "DELETE")
					uni.showToast({
						title: "操作成功！"
					})
					initsd()
				}
			}


		})
	}
	const initsd = async () => {
		uni.showLoading({
			title:"加载中"
		})
		const { data } = await dxrequest("/api/jobregist/page")
		console.log(data.list)
		data.list.map(a => {
			try{
				a.tag = a.tag.split(",")
			}catch(e){
				
			}
		})
		jnmxcz.value = data.list
		uni.hideLoading()
	}
	initsd()
</script>

<style scoped>
	.kmxzczxrec {
		background: #fff;
		border-radius: 8rpx;
	}

	.tag-label {
		display: inline-block;
	}
</style>